﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace HCQ2_Model.DocModel.APIResultModel
{
    /// <summary>
    ///  商品列表模型
    /// </summary>
    public class GoodsListModel
    {
        /// <summary>
        ///  规格最低价
        /// </summary>
        public decimal minPrice { get; set; }
        /// <summary>
        ///  规格最高价
        /// </summary>
        public decimal maxPrice { get; set; }
        /// <summary>
        ///  应用大小
        /// </summary>
        public decimal appSize { get; set; }
        /// <summary>
        ///  应用ID
        /// </summary>
        public string appID { get; set; }
        /// <summary>
        ///  最大人数
        /// </summary>
        public int playerNum { get; set; }
        /// <summary>
        ///  最大时长
        /// </summary>
        public decimal timeSpan { get; set; }
        public int finish_time { get; set; }
        /// <summary>
        ///  是否已售罄
        /// </summary>
        public bool isSoldOut { get; set; }
        /// <summary>
        ///  生产日期距今多少天
        /// </summary>
        public int disDay { get; set; }
        /// <summary>
        ///  生产日期
        /// </summary>
        public string proDate { get; set; }
        public DateTime pdate { get; set; }
        /// <summary>
        ///  经度
        /// </summary>
        public decimal gps_x { get; set; }
        /// <summary>
        ///  纬度
        /// </summary>
        public decimal gps_y { get; set; }
        /// <summary>
        ///  是否主商品
        /// </summary>
        public bool is_mian { get; set; }
        /// <summary>
        ///  是否允许批量购买
        /// </summary>
        public bool is_batch { get; set; }
        /// <summary>
        ///  音频关联数量
        /// </summary>
        public int voice_num { get; set; }
        /// <summary>
        ///  用户商品折扣价
        /// </summary>
        public decimal rate { get; set; }
        /// <summary>
        ///  商铺名称
        /// </summary>
        public string store_name { get; set; }
        /// <summary>
        ///  商铺id
        /// </summary>
        public int store_id { get; set; }
        /// <summary>
        ///  创始人id
        /// </summary>
        public int founder_id { get; set; }
        /// <summary>
        ///  创始人名称
        /// </summary>
        public string founder_name { get; set; }
        /// <summary>
        ///  商铺缩略图
        /// </summary>
        public string store_url { get; set; }
        /// <summary>
        ///  图片关联数量
        /// </summary>
        public int image_num { get; set; }
        /// <summary>
        ///  全景图关联数量
        /// </summary>
        public int pimage_num { get; set; }
        /// <summary>
        ///  视频关联数量
        /// </summary>
        public int video_num { get; set; }
        /// <summary>
        ///  作品关联数量
        /// </summary>
        public int works_num { get; set; }
        /// <summary>
        ///  是否商铺推荐
        /// </summary>
        public bool store_top { get; set; }
        /// <summary>
        ///  是否实体商品
        /// </summary>
        public bool is_entity { get; set; }
        /// <summary>
        ///  外链
        /// </summary>
        public string out_link { get; set; }
        public string prefixUrl { get; set; }
        /// <summary>
        ///  学习人数
        ///  该作品在“作品体验记录”表中有记录的用户数
        /// </summary>
        public int learn_num { get; set; }
        /// <summary>
        ///  题目数
        ///  该作品在“成绩明细”表中的题目数
        /// </summary>
        public int topic_num { get; set; }
        /// <summary>
        ///  正确数
        ///  该作品在“成绩明细”表中状态为“正确”的记录数
        /// </summary>
        public int result_ok { get; set; }
        /// <summary>
        ///  错误数
        ///  该作品在“成绩明细”表中状态为“错误”的记录数
        /// </summary>
        public int result_error { get; set; }
        /// <summary>
        ///  作者头像地址
        /// </summary>
        public string user_head { get; set; }
        /// <summary>
        ///  缩略图id
        /// </summary>
        public int picture_id { get; set; }
        /// <summary>
        ///  缩略图地址
        /// </summary>
        public string picture { get; set; }
        /// <summary>
        ///  作品大小
        /// </summary>
        public decimal option_size { get; set; }
        /// <summary>
        ///  产品类别
        /// </summary>
        public string proType { get; set; }
        /// <summary>
        ///  目录的产品类别
        /// </summary>
        public int folder_pro_type { get; set; }
        /// <summary>
        ///  作品产品类别
        /// </summary>
        public int works_pro_type { get; set; }
        /// <summary>
        ///  商品来源
        ///  0=个人商品；
        ///  1=自营商品
        /// </summary>
        public int supplyType { get; set; }
        /// <summary>
        ///  审核通过时间
        /// </summary>
        public string approve_time { get; set; }
        /// <summary>
        ///  是否推荐
        /// </summary>
        public bool is_recommend { get; set; }
        /// <summary>
        ///  分享次数
        /// </summary>
        public int share_num { get; set; }
        /// <summary>
        ///  是否可编辑
        /// </summary>
        public bool allow_edit { get; set; }
        /// <summary>
        ///  更新时间
        /// </summary>
        public string update_time { get; set; }
        /// <summary>
        ///  作者
        /// </summary>
        public string folder_author { get; set; }
        /// <summary>
        ///  序号
        /// </summary>
        public int file_order { get; set; }
        /// <summary>
        ///  商品类别
        /// </summary>
        public string pageType { get; set; }
        /// <summary>
        ///  商品代码
        /// </summary>
        public string file_code { get; set; }
        /// <summary>
        ///  所属单位
        /// </summary>
        public string org_unit { get; set; }
        /// <summary>
        ///  所在目录id
        /// </summary>
        public int folder_id { get; set; }
        /// <summary>
        ///  所属目录名称
        /// </summary>
        public string folder_name { get; set; }
        /// <summary>
        ///  商品ID（文件ID）
        /// </summary>
        public int file_id { get; set; }
        /// <summary>
        ///  商品名称
        /// </summary>
        public string file_name { get; set; }
        /// <summary>
        ///  二维码代码
        /// </summary>
        public string qr_code { get; set; }
        /// <summary>
        ///  别名
        /// </summary>
        public string alias_name { get; set; }
        /// <summary>
        ///  备注说明
        /// </summary>
        public string file_note { get; set; }
        /// <summary>
        ///  审批意见
        /// </summary>
        public string approve_note { get; set; }
        /// <summary>
        ///  价格
        /// </summary>
        public decimal file_money { get; set; }
        /// <summary>
        ///  点赞次数
        /// </summary>
        public int vr_star { get; set; }
        /// <summary>
        ///  自己是否点过赞
        ///  0：未点赞
        ///  1：已点赞
        /// </summary>
        public int self_star { get; set; }
        /// <summary>
        ///  商品类别
        /// </summary>
        public string file_classify { get; set; }
        /// <summary>
        ///  是否购买
        /// </summary>
        public int is_get { get; set; }
        /// <summary>
        ///  是否收藏
        /// </summary>
        public int is_hold { get; set; }
        /// <summary>
        ///  创建时间
        /// </summary>
        public string create_time { get; set; }
        /// <summary>
        ///  创建人
        /// </summary>
        public string create_name { get; set; }
        /// <summary>
        ///  创建人id
        /// </summary>
        public int create_id { get; set; }
        /// <summary>
        ///  浏览次数
        /// </summary>
        public int browse_num { get; set; }
        /// <summary>
        ///  收藏次数
        /// </summary>
        public int hold_num { get; set; }
        /// <summary>
        ///  购买次数
        /// </summary>
        public int pay_num { get; set; }
        /// <summary>
        ///  下载次数
        /// </summary>
        public int down_number { get; set; }
        /// <summary>
        ///  评论数
        /// </summary>
        public int talk_num { get; set; }
        /// <summary>
        ///  状态
        ///  私有：0 
        ///  待审核：1（发布到商城）
        ///  免费共享：3  弃用=》免费通过价格判断
        ///  下架：4
        ///  已上架：5
        ///  审核未通过：6
        /// </summary>
        public int file_status { get; set; }
        /// <summary>
        ///  宣传地址
        /// </summary>
        public string spread_url { get; set; }
        /// <summary>
        ///  录屏地址
        /// </summary>
        public string video_url { get; set; }
        /// <summary>
        ///  权限
        /// </summary>
        public string folder_limit { get; set; }
        /// <summary>
        ///  产品形态
        ///  1：VR
        ///  2：虚拟仿真
        ///  3：AR
        /// </summary>
        public int pro_form { get; set; }
        /// <summary>
        ///  是否购买
        ///  0：未购买
        ///  1：已购买
        /// </summary>
        public int isPay { get; set; }
        /// <summary>
        ///  是否免费
        /// </summary>
        public int isfree { get; set; }
        /// <summary>
        ///  服务器字典前缀
        /// </summary>
        public string service_ip { get; set; }
        /// <summary>
        ///  楼层数
        /// </summary>
        public string doc_number { get; set; }
    }
    public class GoodsModel: GoodsListModel
    {
        /// <summary>
        ///  前缀地址
        /// </summary>
        public string prefixUrl { get; set; }
        /// <summary>
        ///  正确率
        ///  =正确数/正确数+错误数量
        /// </summary>
        public int accuracy { get; set; }
        /// <summary>
        ///  分享次数
        /// </summary>
        public int share_num { get; set; }
        /// <summary>
        ///  折扣价格列表
        /// </summary>
        public List<GoodsPriceModel> ratePrice { get; set; }
        /// <summary>
        ///  价格列表
        /// </summary>
        public List<GoodsPriceModel> price { get; set; }
        /// <summary>
        ///  附件信息
        /// </summary>
        public List<T_DocFileOptions> fileOption { get; set; }
        /// <summary>
        ///  缩略图信息
        /// </summary>
        public List<T_DocBagFileRecord> photoOption { get; set; }
    }
    /// <summary>
    ///  我的素材、作品模型
    /// </summary>
    public class MyGoodsModel: GoodsModel
    {
        /// <summary>
        ///  附件列表
        /// </summary>
        public List<T_DocFileOptions> fileOption { get; set; }
    }
    /// <summary>
    ///  商品价格模型
    /// </summary>
    public class GoodsPriceModel
    {
        /// <summary>
        ///  主键
        /// </summary>
        public string PurchasePeriodCode { get; set; }
        /// <summary>
        ///  价格名称
        /// </summary>
        public string price_name { get; set; }
        /// <summary>
        ///  月份
        /// </summary>
        public int op_month { get; set; }
        /// <summary>
        ///  金额
        /// </summary>
        public decimal op_price { get; set; }
    }
    /// <summary>
    ///  商品详情模型
    /// </summary>
    public class GoodsDetal: GoodsListModel
    {
        /// <summary>
        ///  前缀地址
        /// </summary>
        public string prefixUrl { get; set; }
        /// <summary>
        ///  价格列表
        /// </summary>
        public List<GoodsPriceModel> price { get; set; }
        /// <summary>
        ///  折扣价格列表
        /// </summary>
        public List<GoodsPriceModel>ratePrice { get; set; }
        /// <summary>
        ///  商品附件列表
        /// </summary>
        public List<GoodsFileOption> files { get; set; }
        /// <summary>
        ///  缩略图列表
        /// </summary>
        public List<T_DocBagFileRecord> photoOption { get; set; }
    }
    /// <summary>
    ///  商品附件附件模型
    /// </summary>
    public class GoodsFileOption
    {
        /// <summary>
        ///  附件id
        /// </summary>
        public int option_id { get; set; }
        /// <summary>
        ///  头显设备设备
        /// </summary>
        public string head_facility { get; set; }
        /// <summary>
        ///  附件名称
        /// </summary>
        public string option_name { get; set; }
        /// <summary>
        ///  附件类别
        /// </summary>
        public string option_type { get; set; }
        /// <summary>
        ///  附件大小
        /// </summary>
        public decimal option_size { get; set; }
        /// <summary>
        ///  运行平台
        /// </summary>
        public string option_plat { get; set; }
        /// <summary>
        ///  附件备注信息
        /// </summary>
        public string option_note { get; set; }
        /// <summary>
        ///  附件所在服务器id
        /// </summary>
        public string service_id { get; set; }
        /// <summary>
        ///  附件所属扩展类别
        /// </summary>
        public string file_suffix { get; set; }
    }
    public class FolderDetial
    {
        /// <summary>
        ///  目录名称
        /// </summary>
        public string folder_name { get; set; }
        /// <summary>
        ///  备注
        /// </summary>
        public string folder_note { get; set; }
        /// <summary>
        ///  缩略图地址
        /// </summary>
        public string folder_url { get; set; }
        /// <summary>
        ///  是否收藏
        /// </summary>
        public bool is_collect { get; set; }
        /// <summary>
        ///   合伙协议
        /// </summary>
        public string deal_note { get; set; }
    }    
    public class FolderDetials: FolderDetial
    {
        /// <summary>
        ///  角色字符串
        /// </summary>
        public string store_type { get; set; }
        /// <summary>
        ///  店铺角色列表：获取用户在该店铺的人员角色的字符串列表
        /// </summary>
        public List<string> roleList { get; set; }
        /// <summary>
        ///  配送距离
        /// </summary>
        public decimal deliveryDistance { get; set; }
        /// <summary>
        ///  店铺商品排序方式
        ///  【3=修改时间降序、4=创建时间降序、5=序号降序、6=序号升序】
        /// </summary>
        public int sortType { get; set; }
        /// <summary>
        ///  经度
        /// </summary>
        public decimal gps_x { get; set; }
        /// <summary>
        ///  纬度
        /// </summary>
        public decimal gps_y { get; set; }
        /// <summary>
        ///  服务类别
        /// </summary>
        public string bs_type { get; set; }
        /// <summary>
        ///  店铺地址
        /// </summary>
        public string bs_address { get; set; }
        /// <summary>
        ///  出品
        /// </summary>
        public string bs_url { get; set; }
        /// <summary>
        ///  工艺
        /// </summary>
        public string bs_note { get; set; }
        /// <summary>
        ///  距离
        /// </summary>
        public int sense { get; set; }
        /// <summary>
        ///  创始人手机号
        /// </summary>
        public string founder_phone { get; set; }
        /// <summary>
        ///  创建时间
        /// </summary>
        public string create_date { get; set; }
        /// <summary>
        ///  创建人
        /// </summary>
        public string create_name { get; set; }
        /// <summary>
        ///  更新时间
        /// </summary>
        public string update_date { get; set; }
        /// <summary>
        ///  更新人
        /// </summary>
        public string update_name { get; set; }
        /// <summary>
        ///  楼层列表
        /// </summary>
        public string floor_level { get; set; }
        /// <summary>
        ///  启用合伙人
        /// </summary>
        public bool statr_partner { get; set; }
        /// <summary>
        ///  店铺合伙人状态
        ///  100=用户是创始人【关系来源于userid】
        ///  -1=未申请；0=待审批
        ///   1=已通过；2=未通过
        /// </summary>
        public int partner_status { get; set; }
        /// <summary>
        ///  是否有子目录
        /// </summary>
        public bool have_child { get; set; }
        /// <summary>
        ///  目录id
        /// </summary>
        public int id { get; set; }
        /// <summary>
        ///  协议地址
        /// </summary>
        public string deal_url { get; set; }
        /// <summary>
        ///  协议id
        /// </summary>
        public int? dealId { get; set; }
        /// <summary>
        ///  节点英文名称
        /// </summary>
        public string enLang { get; set; }
        /// <summary>
        ///  节点父ID
        /// </summary>
        public int pId { get; set; }
        /// <summary>
        ///  Path
        /// </summary>
        public string folder_path { get; set; }
        /// <summary>
        ///  是否私有目录(int)【0=公开目录；1=私有目录】
        /// </summary>
        public int if_private { get; set; }
        /// <summary>
        ///  产品类型（int）：字典value
        /// </summary>
        public int pro_type { get; set; }
        /// <summary>
        ///  产品类别（string）：字典text
        /// </summary>
        public string proType { get; set; }
        /// <summary>
        ///  分组名称
        /// </summary>
        public string group_name { get; set; }
        /// <summary>
        ///  是否推荐（bool）
        /// </summary>
        public bool is_recommend { get; set; }
        /// <summary>
        ///  素材格式
        /// </summary>
        public string materType { get; set; }
        /// <summary>
        ///  是否全员共享(int)【0=不共享；1=全员共享】
        /// </summary>
        public int is_share { get; set; }
        /// <summary>
        ///  序号
        /// </summary>
        public int folder_order { get; set; }
        /// <summary>
        ///  点赞数
        /// </summary>
        public int star_num { get; set; }
        /// <summary>
        ///  收藏数
        /// </summary>
        public int focus_num { get; set; }
        /// <summary>
        ///  用户是否点赞【bool】
        /// </summary>
        public bool isStar { get; set; }
        /// <summary>
        ///  创始人id
        /// </summary>
        public int founder_id { get; set; }
        /// <summary>
        ///  创始人名
        /// </summary>
        public string founder_name { get; set; }
        /// <summary>
        ///  创始人登录名
        /// </summary>
        public string founder_login { get; set; }
        /// <summary>
        ///  创始人用户编码
        /// </summary>
        public string founderid { get; set; }
        /// <summary>
        ///  协议内容
        /// </summary>
        public string deal_note { get; set; }
        /// <summary>
        ///  所属单位
        /// </summary>
        public string unit_code { get; set; }
        /// <summary>
        ///  所属单位名
        /// </summary>
        public string unit_name { get; set; }
        /// <summary>
        ///  城市
        /// </summary>
        public string city { get; set; }

        /// <summary>
        ///  转ResultFolderDetials对象
        /// </summary>
        /// <returns></returns>
        public ResultFolderDetials ToFolderDetials()
        {
            return new ResultFolderDetials
            {
                deal_url = this.deal_url,
                store_type = this.store_type,
                roleList = this.roleList,
                deliveryDistance = this.deliveryDistance,
                sortType = this.sortType,
                id = this.id,
                pId = this.pId,
                folder_name = this.folder_name,
                folder_note = this.folder_note,
                folder_url = this.folder_url?.Replace("~", HttpContext.Current.Request.Url.AbsoluteUri.Substring(0, HttpContext.Current.Request.Url.AbsoluteUri.IndexOf("/api/"))),
                is_collect = this.is_collect,
                enLang = this.enLang,
                folder_path = this.folder_path,
                if_private = this.if_private,
                pro_type = this.pro_type,
                proType = this.proType,
                group_name = this.group_name,
                is_recommend = this.is_recommend,
                materType = this.materType,
                is_share = this.is_share,
                folder_order = this.folder_order,
                star_num = this.star_num,
                focus_num = this.focus_num,
                isStar = this.isStar,
                founder_id = this.founder_id,
                founder_name = this.founder_name,
                unit_code = this.unit_code,
                unit_name = this.unit_name,
                deal_note = this.deal_note,
                gps_x = this.gps_x,
                gps_y = this.gps_y,
                bs_address = this.bs_address,
                bs_type = this.bs_type,
                sense = this.sense,
                founder_phone = this.founder_phone,
                founderid = this.founderid,
                create_date = this.create_date,
                create_name = this.create_name,
                update_date = this.update_date,
                update_name = this.update_name,
                floor_level = this.floor_level,
                statr_partner = this.statr_partner,
                partner_status = this.partner_status,
                city = this.city,
                bs_url = this.bs_url,
                bs_note = this.bs_note
            };
        }
    }
    /// <summary>
    ///  导航树详情
    /// </summary>
    public class ResultFolderDetials: FolderDetials
    {
        /// <summary>
        ///  子节点
        /// </summary>
        public List<ResultFolderDetials> children { get; set; }
    }
}